package com.getsendsocial.GetSendSocial.Util;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.getsendsocial.GetSendSocial.R;

final class MyAdapterSpinner extends ArrayAdapter<String>{
	private LayoutInflater inflater; 
	private ArrayList<String>list;

	public MyAdapterSpinner(Context ctx,int textview,ArrayList<String> lst, LayoutInflater inf){
		super(ctx,textview,lst);		  
		list = new ArrayList<String>();
		inflater = inf;
		for(int i = 0; i< lst.size(); i++){
			list.add(lst.get(i));
		}
	}

	@Override
	public View getDropDownView(int position,View convertView, ViewGroup parent){
		View row = inflater.inflate(R.layout.rowspinner2, parent,false);
		int id = R.id.category2;
		return getCustomView(position,row,parent,id);

	}

	@Override
	public View getView(int position,View convertView, ViewGroup parent){
		View row = inflater.inflate(R.layout.rowspinner, parent,false);
		int id = R.id.category;
		return getCustomView(position,row,parent,id);
	}

	private View getCustomView(int position, View convertView,
			ViewGroup parent,int d) {
		TextView label = (TextView) convertView.findViewById(d);
		label.setText(list.get(position));
		return convertView;
	}
}
